package com.novasoftware.novagooglemap.framework.listener;

import com.novasoftware.novagooglemap.framework.inteface.ISave;
import com.novasoftware.novagooglemap.infrastructure.entity.BaseEntity;

import android.app.Application;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class SaveListener<T extends BaseEntity> implements OnClickListener {

	private ISave<T> _iservice;
	
	public SaveListener(ISave<T> iservice)
	{
		_iservice = iservice;
	}
	
	@Override
	public void onClick(View v) {
		T newEntity = _iservice.UpdateEntity();
		if(_iservice.Save(newEntity))
		{
			Log.i("Insert database", "success:"+newEntity.Id);
		}
	}

}
